package com.it.web.controller;

import com.it.common.aspect.ApiOperationLog;
import com.it.common.utils.Response;
import com.it.web.model.dto.article.FindArticleDetailDto;
import com.it.web.model.dto.article.FindIndexArticlePageListDto;
import com.it.web.service.ArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

@RestController
@RequestMapping("/article")
@Api(tags = "文章")
public class ArticleController {

    @Resource
    private ArticleService articleService;

    @PostMapping("/list")
    @ApiOperation(value = "获取首页文章分页数据")
    @ApiOperationLog(description = "获取首页文章分页数据")
    public Response findArticlePageList(@RequestBody FindIndexArticlePageListDto findIndexArticlePageListDto) {
        return articleService.findArticlePageList(findIndexArticlePageListDto);
    }

    @PostMapping("/detail")
    @ApiOperation(value = "获取文章详情")
    @ApiOperationLog(description = "获取文章详情")
    public Response findArticleDetail(@RequestBody FindArticleDetailDto findArticleDetailDto){

        return articleService.findArticleDetail(findArticleDetailDto);
    }

}
